// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLReplaceable;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "SQLShowCreateViewStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../SQLName.h"

void SQLShowCreateViewStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLShowCreateViewStatement)))
  {
    acceptChild(visitor, name);
  }
  visitor->endVisit(SharedObject(SQLShowCreateViewStatement));
}

SQLName_ptr SQLShowCreateViewStatement::getName()
{
  return name;
}

void SQLShowCreateViewStatement::setName(SQLName_ptr functionName)
{
  this->name = functionName;
}

// @Override
BOOL_ptr SQLShowCreateViewStatement::replace(SQLExpr_ptr expr, SQLExpr_ptr target)
{
  if (name == expr)
  {
    setName(std::dynamic_pointer_cast<SQLName>(target));
    return BOOL::TRUE;
  }

  return BOOL::FALSE;
}
